home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 3 / ct-rom iiib.zip / ct-rom iiib / WINDOWS / GELUID / BILLCD10 / CDPLAY.CPP next >
C/C++ Source or Header  |  1993-03-07  |  18KB  |  561 lines

  1. // ObjectWindows - (C) Copyright 1992 by Borland International
  2. //
  3. // Cup of Fungus Audio CD Player
  4. // Copyright (C) 1993 by Cup of Fungus
  5. // Version 1.0 -- Coded 1/16/93-1/23/93
  6. // Beta Test -- 1/24/93-3/6/93
  7. // Final Bug Fix and Release -- 3/7/93
  8. //
  9. #include <owl.h>      // for ObjectWindows
  10. #include <mmsystem.h> // for MCI API
  11. #include <string.h>   // for strcmp
  12. #include <stdlib.h>   // for the atoi, atol, and rand functions
  13. #include <time.h>     // for the randomize fuction
  14. #include <listbox.h>  // for TListBox
  15. #include <edit.h>     // for TEdit
  16. #include <combobox.h> // for TComboBox
  17. #include "cdplay.h"   // my message and identifier definitions
  18.  
  19. class TCDApp : public TApplication
  20. {
  21. public:
  22.   TCDApp(LPSTR AName, HINSTANCE hInstance, HINSTANCE hPrevInstance,
  23.     LPSTR lpCmdLine, int nCmdShow)
  24.     : TApplication(AName, hInstance, hPrevInstance, lpCmdLine, nCmdShow) {};
  25.   virtual void InitMainWindow();
  26. };
  27.  
  28. _CLASSDEF(TCDDialog)
  29. class TCDDialog : public TDialog
  30. {
  31. public:
  32.     PTListBox CDListBox;
  33.     PTEdit CDCurrentTrackEdit, CDTrackTimeEdit, CDTotalTimeEdit, CDStatusEdit;
  34.   PTComboBox CDPlayModeCombo;
  35.     BOOL IsPaused;
  36.     int CurrentTrack, NumberOfTracks;
  37.     char outputstr[80], buffer[40], Tracks[100][12];
  38.  
  39.     virtual LPSTR GetClassName();
  40.     virtual void SetupCDInformation();
  41.   virtual void UpdateInfo();
  42.   virtual void SetupWindow();
  43.     virtual void GetWindowClass(WNDCLASS&);
  44.     virtual void HandleAboutButtonMsg(RTMessage Msg) = [ID_FIRST + aboutbutton];
  45.     virtual void HandleHelpButtonMsg(RTMessage Msg) = [ID_FIRST + helpbutton];
  46.     virtual void HandleCloseButtonMsg(RTMessage Msg) = [ID_FIRST + closebutton];
  47.     virtual void HandlePlay(RTMessage Msg) = [ID_FIRST + play];
  48.     virtual void HandleForward10(RTMessage Msg) = [ID_FIRST + forward10];
  49.     virtual void HandleTrackForward(RTMessage Msg) = [ID_FIRST + trackforward];
  50.     virtual void HandlePause(RTMessage Msg) = [ID_FIRST + pause];
  51.     virtual void HandleStop(RTMessage Msg) = [ID_FIRST + stop];
  52.     virtual void HandleEject(RTMessage Msg) = [ID_FIRST + eject];
  53.     virtual void HandleTrackBack(RTMessage Msg) = [ID_FIRST + trackback];
  54.     virtual void HandleBack10(RTMessage Msg) = [ID_FIRST + back10];
  55.     virtual void HandleCDListBoxMsg(RTMessage Msg) = [ID_FIRST + numberandtimebox];
  56.   virtual void WMTimer(RTMessage Msg) = [WM_FIRST + WM_TIMER];
  57.     TCDDialog(PTWindowsObject AParent, int ResourceId);
  58. };
  59.  
  60. _CLASSDEF(TCDAbout)
  61. class TCDAbout : public TDialog
  62. {
  63. public:
  64.         virtual void HandleSendMoneyButtonMsg(RTMessage Msg) = [ID_FIRST + sendthemoneybutton];
  65.         TCDAbout(PTWindowsObject AParent, int ResourceId)
  66.             : TDialog(AParent, ResourceId) {};
  67. };
  68.  
  69. _CLASSDEF(TCDHelp)
  70. class TCDHelp : public TDialog
  71. {
  72. public:
  73.     PTListBox HelpListBox;
  74.     PTEdit HelpEdit;
  75.  
  76.     TCDHelp(PTWindowsObject AParent, int ResourceId);
  77.   virtual void SetupWindow();
  78.     virtual void HandleHelpListBoxMsg(RTMessage Msg) = [ID_FIRST + helplistbox];
  79.   virtual void HandleButton1Msg(RTMessage Msg) = [ID_FIRST + helphelpbutton];
  80.   virtual void HandleButton2Msg(RTMessage Msg) = [ID_FIRST + cancelbutton];
  81.     virtual void FillHelpEdit(Pchar SelString);
  82. };
  83.  
  84. TCDDialog::TCDDialog(PTWindowsObject AParent, int ResourceId)
  85.     : TDialog(AParent, ResourceId)
  86. {
  87.     CDListBox = new TListBox(this, numberandtimebox);
  88.     CDCurrentTrackEdit = new TEdit(this, currenttrackbox, 40);
  89.     CDTrackTimeEdit = new TEdit(this, tracktimebox, 40);
  90.     CDTotalTimeEdit = new TEdit(this, totaltimebox, 40);
  91.     CDStatusEdit = new TEdit(this, statusbox, 40);
  92.     CDPlayModeCombo = new TComboBox(this, playmodebox, 40);
  93. };
  94.  
  95.  
  96. TCDHelp::TCDHelp(PTWindowsObject AParent, int ResourceId)
  97.     : TDialog(AParent, ResourceId)
  98. {
  99.     HelpListBox = new TListBox(this, helplistbox);
  100.     HelpEdit = new TEdit(this, helpeditbox, 40);
  101. }
  102.  
  103. void TCDDialog::SetupWindow()
  104. {
  105.     int crashbutton;
  106.   BOOL Bomb;
  107.  
  108.     TDialog::SetupWindow();
  109.   Bomb=FALSE;
  110.     if (!SetTimer(HWindow, 1, 1000, NULL))
  111.         MessageBox(HWindow, "Too Many Timers!", "Fungus Warning", MB_OK | MB_ICONEXCLAMATION);
  112.     mciSendString((LPSTR)"open cdaudio", buffer, 40, NULL);
  113.         // if above was successful buffer should be "1" otherwise it's ""
  114.   while(strcmp(buffer,"")==0) {
  115.         crashbutton=MessageBox(HWindow, "Can't open MCI CD Audio!\n\nInsert an audio CD and\npress OK to continue.\n\nOr press CANCEL to quit.", "Fungus Error", MB_OKCANCEL | MB_ICONEXCLAMATION);
  116.         if(crashbutton==IDCANCEL) {
  117.             Bomb=TRUE;
  118.             break;  // this will exit the WHILE loop if CANCEL is pressed
  119.     }
  120.         else mciSendString((LPSTR)"open cdaudio", buffer, 40, NULL);
  121.     }
  122.     if(Bomb) CloseWindow();  // if CANCEL was pressed then quit the program
  123.     mciSendString((LPSTR)"set cdaudio time format tmsf", NULL, 0, NULL);
  124.     mciSendString("status cdaudio current track", buffer, 40, NULL);
  125.     CurrentTrack=(int)atoi(buffer);
  126.     IsPaused=FALSE;
  127.     CDPlayModeCombo->AddString(" Continuous");
  128.     CDPlayModeCombo->AddString(" Random");
  129.     CDPlayModeCombo->AddString(" Single");
  130.     CDPlayModeCombo->SetSelIndex(0);
  131.     SetupCDInformation();
  132.     mciSendString("status cdaudio mode", buffer, 40, NULL);
  133.     if(strcmp(buffer, "playing")==0) CDStatusEdit->SetText("Playing");
  134.     else {
  135.         CDStatusEdit->SetText("Stopped");
  136.         CDCurrentTrackEdit->SetText("1");
  137.         CDTrackTimeEdit->SetText("00:00");
  138.         CDTotalTimeEdit->SetText("00:00");
  139.     }
  140. }
  141.  
  142. void TCDDialog::SetupCDInformation(void)
  143. {
  144.     int i;
  145.     mciSendString("status cdaudio number of tracks", buffer, 40, NULL);
  146.     NumberOfTracks=(int)atoi(buffer);
  147.     CDListBox->ClearList();
  148.     for(i=1;i<=NumberOfTracks;i++) {
  149.     wsprintf(buffer, "status cdaudio length track %d", i);
  150.         mciSendString(buffer, Tracks[i], 12, NULL);
  151.         wsprintf(outputstr, " Track %2d:   %c%c:%c%c", i, Tracks[i][0], Tracks[i][1], Tracks[i][3], Tracks[i][4]);
  152.         CDListBox->AddString(outputstr);
  153.     }
  154.     CDListBox->SetSelIndex(CurrentTrack-1);
  155. }
  156.  
  157. void TCDDialog::UpdateInfo(void)
  158. {
  159.     char tempbuffer[40];
  160.     static int temptrack, tempprevtrack=0, randomtrack;
  161.  
  162.     mciSendString("status cdaudio mode", outputstr, 80, NULL);
  163.     if(strcmp(outputstr, "playing")==0) {
  164.         mciSendString((LPSTR)"set cdaudio time format tmsf", NULL, 0, NULL);
  165.         mciSendString("status cdaudio position", outputstr, 80, NULL);
  166.         wsprintf(tempbuffer, "%c%c:%c%c", outputstr[3], outputstr[4], outputstr[6], outputstr[7]);
  167.         CDTrackTimeEdit->SetText(tempbuffer);
  168.  
  169.         mciSendString("set cdaudio time format msf", NULL , 0, NULL);
  170.         mciSendString("status cdaudio position", outputstr, 80, NULL);
  171.         wsprintf(tempbuffer, "%c%c:%c%c", outputstr[0], outputstr[1], outputstr[3], outputstr[4]);
  172.         CDTotalTimeEdit->SetText(tempbuffer);
  173.         mciSendString("set cdaudio time format tmsf", NULL, 0, NULL);
  174.  
  175.         mciSendString("status cdaudio current track", outputstr, 80, NULL);
  176.         temptrack=atoi(outputstr);
  177.         if(temptrack!=tempprevtrack) {
  178.             switch(CDPlayModeCombo->GetSelIndex()) {
  179.           case 0:
  180.                     CDCurrentTrackEdit->SetText(outputstr);
  181.                     CurrentTrack=temptrack;
  182.                     CDListBox->SetSelIndex(CurrentTrack-1);
  183.                     break;
  184.                 case 1:
  185.             randomize();
  186.                     randomtrack=(rand()%NumberOfTracks)+1;
  187.                     wsprintf(buffer, "play cdaudio from %d", randomtrack);
  188.                     mciSendString(buffer, NULL, 0, NULL);
  189.                     wsprintf(outputstr, "%d", randomtrack);
  190.                     CDCurrentTrackEdit->SetText(outputstr);
  191.                     CurrentTrack=randomtrack;
  192.                     CDListBox->SetSelIndex(randomtrack-1);
  193.                     temptrack=randomtrack;
  194.                     break;
  195.                 case 2:
  196.                     wsprintf(outputstr, "play cdaudio from %d", tempprevtrack);
  197.                     mciSendString(outputstr, NULL, 0, NULL);
  198.                     temptrack=tempprevtrack;
  199.           CDListBox->SetSelIndex(temptrack-1);
  200.                     break;
  201.       }
  202.         }
  203.     tempprevtrack=temptrack;
  204.     }
  205. }
  206.  
  207. void TCDDialog::WMTimer(RTMessage Msg)
  208. {
  209.     UpdateInfo();
  210. }
  211.  
  212. LPSTR TCDDialog::GetClassName()
  213. {
  214.     return("TCDDialog");
  215. }
  216.  
  217. void TCDDialog::GetWindowClass(WNDCLASS& AWndClass)
  218. {
  219.     TDialog::GetWindowClass(AWndClass);
  220.     AWndClass.hIcon = LoadIcon(GetApplication()->hInstance, "cdicon");
  221. }
  222.  
  223. void TCDDialog::HandleAboutButtonMsg(RTMessage Msg)
  224. {
  225.     GetModule()->ExecDialog(new TCDAbout(this, aboutbox));
  226. }
  227.  
  228. void TCDAbout::HandleSendMoneyButtonMsg(RTMessage Msg)
  229. {
  230.     CloseWindow();
  231. }
  232.  
  233. void TCDDialog::HandleHelpButtonMsg(RTMessage Msg)
  234. {
  235.     GetModule()->ExecDialog(new TCDHelp(this, helpbox));
  236. }
  237.  
  238. void TCDDialog::HandleCloseButtonMsg(RTMessage Msg)
  239. {
  240.     mciSendString("close cdaudio", NULL, 0, NULL);
  241.   IsPaused=FALSE;
  242.     CloseWindow();
  243. }
  244.  
  245. void TCDDialog::HandlePlay(RTMessage Msg)
  246. {
  247.     mciSendString("status cdaudio mode", buffer, 40, NULL);
  248.     if(strcmp(buffer, "stopped")==0 && (!IsPaused)) SetupCDInformation();
  249.  
  250.     if(!IsPaused) {
  251.         wsprintf(outputstr, "play cdaudio from %d", (CDListBox->GetSelIndex())+1);
  252.         mciSendString((LPSTR)outputstr, NULL, 0, NULL);
  253.     }
  254.     else {
  255.         mciSendString("play cdaudio", NULL, 0, NULL);
  256.         IsPaused=FALSE;
  257.     }
  258.     CDStatusEdit->SetText("Playing");
  259. }
  260.  
  261. void TCDDialog::HandleStop(RTMessage Msg)
  262. {
  263.     mciSendString((LPSTR)"stop cdaudio", NULL, 0, NULL);
  264.     CDListBox->SetSelIndex(0);
  265.   CurrentTrack=1;
  266.     IsPaused=FALSE;
  267.     CDStatusEdit->SetText("Stopped");
  268.     CDCurrentTrackEdit->SetText("1");
  269.     CDTrackTimeEdit->SetText("00:00");
  270.   CDTotalTimeEdit->SetText("00:00");
  271. }
  272.  
  273. void TCDDialog::HandlePause(RTMessage Msg)
  274. {
  275.     if(!IsPaused) {
  276.         mciSendString((LPSTR)"pause cdaudio", NULL, 0, NULL);
  277.         IsPaused=TRUE;
  278.         CDStatusEdit->SetText("Paused");
  279.   }
  280.     else {
  281.         mciSendString((LPSTR)"play cdaudio", NULL, 0, NULL);
  282.         IsPaused=FALSE;
  283.         CDStatusEdit->SetText("Playing");
  284.     }
  285. }
  286.  
  287. void TCDDialog::HandleTrackForward(RTMessage Msg)
  288. {
  289.     mciSendString("status cdaudio current track", buffer, 40, NULL);
  290.     CurrentTrack=(int)atoi(buffer);
  291.     if(CurrentTrack<NumberOfTracks) CurrentTrack++;
  292.     else CurrentTrack=1;
  293.     IsPaused=FALSE;
  294.     wsprintf(buffer, "play cdaudio from %d", CurrentTrack);
  295.     mciSendString(buffer, NULL, 0, NULL);
  296.   CDStatusEdit->SetText("Playing");
  297. }
  298.  
  299. void TCDDialog::HandleTrackBack(RTMessage Msg)
  300. {
  301.     mciSendString("status cdaudio current track", buffer, 40, NULL);
  302.     CurrentTrack=(int)atoi(buffer);
  303.     if(CurrentTrack>1) CurrentTrack--;
  304.     else CurrentTrack=NumberOfTracks;
  305.     wsprintf(buffer, "play cdaudio from %d", CurrentTrack);
  306.     mciSendString(buffer, NULL, 0, NULL);
  307.   CDStatusEdit->SetText("Playing");
  308. }
  309.  
  310. void TCDDialog::HandleEject(RTMessage Msg)
  311. {
  312.         HandleStop(Msg);
  313.         mciSendString("set cdaudio door open", NULL, 0, NULL);
  314. }
  315.  
  316. void TCDDialog::HandleForward10(RTMessage Msg)
  317. {
  318.     long int CDPosition;
  319.     mciSendString("set cdaudio time format milliseconds", NULL, 0, NULL);
  320.     mciSendString("status cdaudio position", buffer, 40, NULL);
  321.     CDPosition=(long)atol(buffer);
  322.     CDPosition+=10000;  // adds 10 seconds to position
  323.   wsprintf(buffer, "seek cdaudio to %ld", CDPosition);
  324.     mciSendString(buffer, NULL, 0, NULL);
  325.     mciSendString("play cdaudio", NULL, 0, NULL);
  326.     IsPaused=FALSE;
  327.   CDStatusEdit->SetText("Playing");
  328.     mciSendString("set cdaudio time format tmsf", NULL, 0, NULL);
  329.     mciSendString("status cdaudio current track", buffer, 40, NULL);
  330.     CurrentTrack=(int)atoi(buffer);
  331. }
  332.  
  333. void TCDDialog::HandleBack10(RTMessage Msg)
  334. {
  335.     long int CDPosition;
  336.     mciSendString("set cdaudio time format milliseconds", NULL, 0, NULL);
  337.     mciSendString("status cdaudio position", buffer, 40, NULL);
  338.     CDPosition=(long)atol(buffer);
  339.     CDPosition-=10000;  // subtracts 10 seconds from position
  340.     if(CDPosition<0) CDPosition=0;
  341.   wsprintf(buffer, "seek cdaudio to %ld", CDPosition);
  342.     mciSendString(buffer, NULL, 0, NULL);
  343.     mciSendString("play cdaudio", NULL, 0, NULL);
  344.     IsPaused=FALSE;
  345.     CDStatusEdit->SetText("Playing");
  346.     mciSendString("set cdaudio time format tmsf", NULL, 0, NULL);
  347.     mciSendString("status cdaudio current track", buffer, 40, NULL);
  348.     CurrentTrack=(int)atoi(buffer);
  349. }
  350.  
  351. void TCDDialog::HandleCDListBoxMsg(RTMessage Msg)
  352. {
  353.   int trackselected;
  354.  
  355.   if ( Msg.LP.Hi == LBN_DBLCLK )
  356.   {
  357.         trackselected=(CDListBox->GetSelIndex())+1;
  358.         wsprintf(buffer, "play cdaudio from %d", trackselected);
  359.         mciSendString(buffer, NULL, 0, NULL);
  360.         CDStatusEdit->SetText("Playing");
  361.         IsPaused=FALSE;
  362.   }
  363. }
  364.  
  365. void TCDHelp::SetupWindow()
  366. {
  367.   TDialog::SetupWindow();
  368.     
  369.     HelpListBox->AddString("< (10 sec. back)");
  370.     HelpListBox->AddString("> (10 sec. forward)");
  371.     HelpListBox->AddString("<< (Track Back)");
  372.     HelpListBox->AddString(">> (Track Forward)");
  373.     HelpListBox->AddString("Close");
  374.   HelpListBox->AddString("Current Track");
  375.     HelpListBox->AddString("Eject");
  376.     HelpListBox->AddString("Pause");
  377.     HelpListBox->AddString("Play");
  378.     HelpListBox->AddString("Play Mode");
  379.   HelpListBox->AddString("Status");
  380.     HelpListBox->AddString("Stop");
  381.     HelpListBox->AddString("Tips & Techniques");
  382.     HelpListBox->AddString("Total Time");
  383.   HelpListBox->AddString("Track #'s & Time");
  384.   HelpListBox->AddString("Track Time");
  385.     HelpListBox->SetSelIndex(0);
  386. };
  387.  
  388. void TCDHelp::HandleHelpListBoxMsg(RTMessage Msg)
  389. {
  390.   char SelString[25];
  391.  
  392.   if ( Msg.LP.Hi == LBN_DBLCLK )
  393.   {
  394.         HelpListBox->GetSelString(SelString, sizeof(SelString));
  395.         FillHelpEdit(SelString);
  396.   }
  397. }
  398.  
  399. void TCDHelp::HandleButton1Msg(RTMessage)
  400. {
  401.   char SelString[25];
  402.  
  403.   HelpListBox->GetSelString(SelString, sizeof(SelString));
  404.     FillHelpEdit(SelString);
  405. }
  406.  
  407. void TCDHelp::HandleButton2Msg(RTMessage)
  408. {
  409.   CloseWindow();
  410. }
  411.  
  412. void TCDHelp::FillHelpEdit(Pchar SelString)
  413. {
  414.   Pchar HelpStr;
  415.  
  416.   if ( strcmp(SelString, "<< (Track Back)") == 0 )
  417.     {  HelpStr =
  418.                 "<< plays the track on the CD that\r\n"
  419.                 "is immediately before the current\r\n"
  420.                 "track.  It is a Track Rewind. In\r\n"
  421.                 "Random mode this jumps to a\r\n"
  422.                 "random track.  In Single mode it\r\n"
  423.                 "jumps to the beginning of the\r\n"
  424.         "current track.";
  425.     };
  426.   if ( strcmp(SelString, "< (10 sec. back)") == 0 )
  427.     {  HelpStr =
  428.                 "< moves to the position on the CD\r\n"
  429.                 "that is 10 seconds before the\r\n"
  430.                 "current position.  It is a Position\r\n"
  431.                 "Rewind.";
  432.     }
  433.   if ( strcmp(SelString, "Play") == 0 )
  434.     {  HelpStr =
  435.                 "Unless the CD is paused, Play starts\r\n"
  436.                 "the CD at the track currently selected\r\n"
  437.                 "in the 'Track Numbers and Times'\r\n"
  438.                 "box.  If paused, the CD will resume\r\n"
  439.                 "playing when Play is pressed.";
  440.     };
  441.   if ( strcmp(SelString, "> (10 sec. forward)") == 0 )
  442.   {  HelpStr =
  443.                 "> moves to the position on the CD\r\n"
  444.                 "that is 10 seconds after the\r\n"
  445.                 "current position.  It is a Position\r\n"
  446.         "Fast Forward.";
  447.     };
  448.   if ( strcmp(SelString, ">> (Track Forward)") == 0 )
  449.   {  HelpStr =
  450.                 ">> plays the track on the CD that is\r\n"
  451.                 "immediately after the current track.\r\n"
  452.                 "It is a Track Fast Forward.  In\r\n"
  453.                 "Random mode it jumps to a random\r\n"
  454.                 "track.  In Single mode it jumps to\r\n"
  455.                 "the beginning of the current track.";
  456.     };
  457.   if ( strcmp(SelString, "Pause") == 0 )
  458.     {  HelpStr =
  459.                 "Pause pauses the CD if it is\r\n"
  460.                 "playing and resumes playing the\r\n"
  461.                 "CD if it is pressed again.";
  462.     };
  463.   if (strcmp(SelString, "Stop") == 0 )
  464.     {  HelpStr =
  465.                 "Stop ends the playback of the CD,\r\n"
  466.                 "and moves the current position\r\n"
  467.         "back to the beginning of the CD.";
  468.     };
  469.   if ( strcmp(SelString, "Eject") == 0 )
  470.     {  HelpStr =
  471.                 "Eject ends the playback of the CD, \r\n"
  472.                 "and ejects the CD from the drive--\r\n"
  473.                 "but only if the drive has software\r\n"
  474.         "eject capabilities.";
  475.     };
  476.   if ( strcmp(SelString, "Close") == 0 )
  477.     {  HelpStr =
  478.                 "Close ends the Cup of Fungus Audio\r\n"
  479.                 "CD Player application.  It allows\r\n"
  480.                 "the CD to continue playback if it\r\n"
  481.         "is playing when Close is pressed.";
  482.     };
  483.     if ( strcmp(SelString, "Play Mode") == 0 )
  484.     {        HelpStr =
  485.                 "Continuous, Random, and Single\r\n"
  486.                 "modes are available.  Continuous\r\n"
  487.                 "plays each track in the order they\r\n"
  488.                 "are on the CD.  Random plays them\r\n"
  489.                 "in a random order (with repeats\r\n"
  490.                 "allowed).  Single plays only the\r\n"
  491.                 "current track.";
  492.     };
  493.     if (strcmp(SelString, "Track #'s & Time") == 0)
  494.     {        HelpStr =
  495.                 "This box displays the length of each\r\n"
  496.                 "track on the disk in the order that\r\n"
  497.         "they appear on the disk.";
  498.     };
  499.     if (strcmp(SelString, "Current Track")==0)
  500.     {        HelpStr =
  501.                 "This box shows the number of the\r\n"
  502.                 "current track.";
  503.     };
  504.     if (strcmp(SelString, "Track Time")==0)
  505.     {        HelpStr =
  506.                 "This shows the minutes and seconds\r\n"
  507.                 "from the beginning of the current\r\n"
  508.                 "track to the current position.";
  509.     };
  510.     if (strcmp(SelString, "Total Time")==0)
  511.     {        HelpStr =
  512.                 "This shows the minutes and seconds\r\n"
  513.                 "from the beginning of the CD to the\r\n"
  514.                 "current position.";
  515.     };
  516.     if (strcmp(SelString, "Status")==0)
  517.     {        HelpStr =
  518.                 "This box displays the status of the\r\n"
  519.                 "CD.  The possible messages are\r\n"
  520.                 "Playing, Paused, and Stopped---\r\n"
  521.                 "which are self-explanatory.";
  522.   };
  523.     if ( strcmp(SelString, "Tips & Techniques") == 0 )
  524.     {        HelpStr =
  525.                 "This application requires Microsoft\r\n"
  526.                 "Windows 3.1.\r\n"
  527.                 "The '[MCI] CD Audio' driver MUST\r\n"
  528.                 "be installed for this to work (through\r\n"
  529.                 "the 'Control Panel | Drivers | Add'\r\n"
  530.                 "facility.)\r\n"
  531.                 "Cup of Fungus was originally the\r\n"
  532.                 "name of my band, but when all the\r\n"
  533.                 "members left but me and my best\r\n"
  534.                 "friend, we decided to turn it into\r\n"
  535.                 "a Creative Team.  Now we are\r\n"
  536.                 "slowly (VERY SLOWLY!) building\r\n"
  537.                 "our empire with the returns from our\r\n"
  538.                 "creative efforts.  By the year 2075,\r\n"
  539.                 "we plan to be a formidable market\r\n"
  540.                 "presence.  Watch for us, or better\r\n"
  541.                 "yet, send money! (Comments are\r\n"
  542.         "also welcomed...)";
  543.   };
  544.     HelpEdit->SetText(HelpStr);
  545. }
  546.  
  547. void TCDApp::InitMainWindow()
  548. {                                                 
  549.     MainWindow = new TCDDialog(NULL, cdplaybox);
  550. }
  551.  
  552. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  553.   LPSTR lpCmdLine, int nCmdShow)
  554. {
  555.   TCDApp CDApp("Cup of Fungus Audio CD Player", hInstance, hPrevInstance,
  556.                              lpCmdLine, nCmdShow);
  557.     if(hPrevInstance!=0) return CDApp.Status;
  558.   CDApp.Run();
  559.   return CDApp.Status;
  560. }
  561.